'''
Created on 05-09-2012

@author: polo
'''
import pygame
import random
class Scenes(object):
    def __init__(self,screen):
        self.scenes=["wood","castle"]
        self.index=0   
        self.HIGH_START=280
        self.block_start=0
        self.block_end=0
        self.setBlocks()
        self.STATUS_START=0
        self.STATUS_LOOP=1
        self.STATUS_END=2
        self.status=self.STATUS_START
    def setBlocks(self):
        if self.scenes[self.index]=="wood":
            self.blocks = [
            pygame.image.load("images/blck1.png"),
            pygame.image.load("images/blck2.png")
            ]
            self.block_start=pygame.image.load("images/blck_start.png")
            self.block_end=pygame.image.load("images/blck_end_wood.png")
        elif self.scenes[self.index]=="castle":
            self.blocks = [
            pygame.image.load("images/blck_loop-castle.png")
            ]
            self.block_start=pygame.image.load("images/blck_start-castle.png")
            self.block_end=pygame.image.load("images/blck_end-castle.png")
    def getOffset(self,speed):
        if self.status==self.STATUS_LOOP:
            if self.scenes[self.index]=="wood":
                return 50+random.randint(0,100)+speed*2-16
            elif self.scenes[self.index]=="castle":
                return 0
        else:
            return 0
    def getHigh(self):
        if self.status==self.STATUS_LOOP:
            if self.scenes[self.index]=="wood":
                return 180-random.randint(0,50)
            elif self.scenes[self.index]=="castle":
                return 180
        else:
            return 180
    def getBlockLoop(self):
        if self.status==self.STATUS_START:
            return self.block_start
        elif self.status==self.STATUS_END:
            return self.block_end
        return self.blocks[random.randint(0,self.blocks.__len__()-1)]
    def changeScene(self, index):
        self.index=index
        self.setBlocks() 
        
        
            